#include "DiolObjectInstance.h"

#include <assert.h>
#include "DiolCommon.h"

namespace Diol
{

ObjectInstance::ObjectInstance()
	: mName()
{
	memset( &mDeviceObjectInstance, 0, sizeof(DIDEVICEOBJECTINSTANCE) );
}

ObjectInstance::ObjectInstance( LPCDIDEVICEOBJECTINSTANCE deviceObjectInstance )
	: mName()
{
	memcpy( &mDeviceObjectInstance, deviceObjectInstance, sizeof(DIDEVICEOBJECTINSTANCE) );
}

ObjectInstance::ObjectInstance( const ObjectInstance& other )
	: mName( other.mName )
{
	memcpy( &mDeviceObjectInstance, &(other.mDeviceObjectInstance), sizeof(DIDEVICEOBJECTINSTANCE) );
}

ObjectInstance& ObjectInstance::operator=( const ObjectInstance& other )
{
	memcpy( &mDeviceObjectInstance, &(other.mDeviceObjectInstance), sizeof(DIDEVICEOBJECTINSTANCE) );
	mName = other.mName;
	return *this;
}

std::string	ObjectInstance::getName() const
{
	if ( mName.empty() )
		mName = Common::TCHARToUTF8( getRawName() );
	return mName;
}

/*
const char* ObjectInstance::getGuidTypeString() const
{
	const GUID&	guidType = getGuidType();
	if ( guidType==GUID_XAxis ) 
		return "GUID_XAxis";
	else if ( guidType==GUID_YAxis ) 
		return "GUID_YAxis";
	else if ( guidType==GUID_ZAxis ) 
		return "GUID_ZAxis";
	else if ( guidType==GUID_RxAxis ) 
		return "GUID_RxAxis";
	else if ( guidType==GUID_RyAxis ) 
		return "GUID_RyAxis";
	else if ( guidType==GUID_RzAxis ) 
		return "GUID_RzAxis";
	else if ( guidType==GUID_Slider ) 
		return "GUID_Slider";
	else if ( guidType==GUID_Button ) 
		return "GUID_Button";
	else if ( guidType==GUID_Key ) 
		return "GUID_Key";
	else if ( guidType==GUID_POV ) 
		return "GUID_POV";
	else if ( guidType==GUID_Unknown ) 
		return "GUID_Unknown";
	return "GUID_UNDEFINED";
}*/

}